home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / feel0_89.lha / Feel / Src / set.c < prev    next >
C/C++ Source or Header  |  1993-02-02  |  1KB  |  59 lines

  1. /* ******************************************************************** */
  2. /*  set.c            Copyright (C) Codemist and University of Bath 1989 */
  3. /*                                                                      */
  4. /*  support for "set"                                                   */
  5. /* ******************************************************************** */
  6.  
  7. /*
  8.  * Change Log:
  9.  *   Version 1, May 1989
  10.  * 
  11.  *   Had to add a new function to get it to work on anoymous functions
  12.  *                                                      (16/11/89) KJP
  13.  *   Mostly killed. Pab (11/11/92)
  14.  */
  15.  
  16. #include "defs.h"
  17. #include "structs.h"
  18. #include "funcalls.h"
  19.  
  20. #include "error.h"
  21. #include "global.h"
  22. #include "class.h"
  23. #include "ngenerics.h"
  24.  
  25. /* associate the updator with the function func: both are ids */
  26.  
  27. /* as above for function objects */
  28.  
  29. void set_anon_associate(LispObject *stacktop, LispObject get,LispObject set)
  30. {
  31.   if (is_c_function(get))
  32.     get->C_FUNCTION.setter=set;
  33.   else
  34.     {
  35.       if (is_generic(get))
  36.     generic_setter(get)=set;
  37.       else 
  38.     CallError(stacktop,"Daft setter",nil,NONCONTINUABLE);
  39.     }
  40. }    
  41.  
  42. static EUFUN_1(Fn_c_setter,x)
  43. {
  44.   return(x->C_FUNCTION.setter);
  45. }
  46. EUFUN_CLOSE
  47.  
  48. static EUFUN_2(Fn_c_setter_setter,x,y)
  49. {
  50.   return (x->C_FUNCTION.setter=y);
  51. }
  52. EUFUN_CLOSE
  53.  
  54. void initialise_set(LispObject *stacktop)
  55. {
  56.   make_module_function(stacktop,"c-setter",Fn_c_setter,1);
  57.   make_module_function(stacktop,"c-setter-setter",Fn_c_setter_setter,2);
  58. }
  59.